package com.atguigu.lease.web.admin.globalhandexception;

import com.atguigu.lease.common.result.Result;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * TODO
 *
 * @Author mr.luo
 * @Date 21 5月 2025 11:56
 */
@Hidden
@Slf4j
@RestControllerAdvice
public class GlobalHandleException {

    @ExceptionHandler
    public Result handleException(Exception e) {
        log.error("出现异常",e);
        return Result.fail(e.getMessage());
    }

    @ExceptionHandler
    public Result handleException(CommonException e) {
        log.error("出现异常",e);
        return Result.fail(e.getMessage());
    }
}
